// 创造中间件

export const logger = function(store){
  return function(dispatch){
    return function (action){
      console.log('老数据',store.getState())
      dispatch(action)//改数据
      console.log('新数据',store.getState())
    }
  }
}
export const reduxThunk = store=>dispatch=>action=>{
  if(typeof action == 'function'){
    return action(dispatch,store.getState)
  }
  dispatch(action)
}